sling-web-sdk
The sling-web-sdk is a front-end layer of abstraction for
communicating with all kinds of back-end services. Built with Redux, it's
usable in any framework in the front-end, now and in the future.
Usage
npm install --save sling-web-sdk
Store
Import and pass the store to your application. This step
depends on the framework (or the lack of) that you are using,
but in most cases, you can just import it at the entry point.
import { Store } from 'sling-web-sdk';
Actions
The actions are generic functions that, most of the time,
consume endpoints and populate data. For example,
the globalActions contains the login action.
The login action in particular will call the stabilished endpoint
and set the token at the localStorage. To use it, you just have to:
import { Store, globalActions } from 'sling-web-sdk';
Store.dispatch(globalActions.logIn('user@email.com', 'userpass');
By default this action will point to the portal API.